package words;

import java.io.PrintWriter;
import java.util.ArrayList;

public class ArticleResult {
	private ArrayList<Result> results;
	private int id;

	public ArticleResult(int id) {
		this.id = id;
		results = new ArrayList<Result>();
	}

	public Result getResult(int value) {
		return this.results.get(value);
	}

	public Boolean add_result(Result result) {
		try {
			this.results.add(result);
			return true;
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}

	}

	public int getId() {
		return this.id;
	}

	// Big Controller calling this function, for output the result from different condition in each article
	public void output_file(PrintWriter out, int artNum) {
		out.append("<table border=\"1\" style=\"text-align:center\" width=\"72%\" align=\"center\">");
		out.append("<tr><td> Article ID</td><td>AWL result</td><td>Noun Result</td><td>Preposition Result</td>" +
				"<td>Punctuation Result</td><td>Quotation Result</td><td>Number Result</td><td> Similar Rate (Out of 100)</td>" +
				"<td>Plagiarism Checking</td><tr>");
		for (int i = 0; i < results.size(); i++) {
			out.write(results.get(i).toString());
			out.println();
			

		}
		out.append("</table>");
	}
}
